#include "head.h"

#define FIFO_NAME "./fifo_test"

int main(int argc, char const *argv[])
{
    mkfifo( FIFO_NAME, 0777 );

    int FifoFd;
    FifoFd = open( FIFO_NAME, O_WRONLY );
    if ( -1 == FifoFd )
    {
        perror( "fail open fifo" );
        return -1;
    }

    int i;
    for( i = 1; i <= 100; ++i ) 
    {
        char strBuff[1024] = "Message from Send proccess";
        ssize_t Ret;
        Ret = write( FifoFd, strBuff, strlen( strBuff )+1  );
        if ( -1 == Ret )
        {
            perror( "fail write" );
            return -1;
        }
        printf( "Conter %3d --- Sendto FIFO: %s\n", i, strBuff );
        sleep(1);
    }

    close( FifoFd );

    return 0;
}
